package p270jp.pxv.android.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/* renamed from: jp.pxv.android.widget.SnappyRecyclerView */
/* loaded from: classes2.dex */
public class SnappyRecyclerView extends RecyclerView {
    public SnappyRecyclerView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    @Override // androidx.recyclerview.widget.RecyclerView
    /* renamed from: I */
    public boolean mo4379I(int i, int i2) {
        LinearLayoutManager linearLayoutManager = (LinearLayoutManager) getLayoutManager();
        if (i > 0) {
            View D = linearLayoutManager.mo10832D(linearLayoutManager.m10934h1());
            if (D == null) {
                return true;
            }
            int left = D.getLeft() - ((getWidth() - D.getWidth()) / 2);
            if (left > D.getWidth()) {
                left -= D.getWidth();
            }
            m10856n0(left, 0);
        } else {
            View D2 = linearLayoutManager.mo10832D(linearLayoutManager.m10935g1());
            if (D2 == null) {
                return true;
            }
            int width = (D2.getWidth() + ((getWidth() - D2.getWidth()) / 2)) - D2.getRight();
            if (width > D2.getWidth()) {
                width -= D2.getWidth();
            }
            m10856n0(-width, 0);
        }
        return true;
    }
}
